import request from './request.js';

const https = {
  get(params,url,headers) {
    const config = {
      method: 'get',
      url,
      header: headers ? 'application/x-www-form-urlencoded' : 'application/json',
    }
    if (params) config.params = params
    return request(config)
  },
  post(params,url,headers) {
    const config = {
      method: 'post',
      url,
      header: headers ? 'application/x-www-form-urlencoded' : 'application/json',
    }
    if (params) config.params = params
    return request(config)
  },
  put(params,url,headers) {
    const config = {
      method: 'put',
      url,
      header: headers ? 'application/x-www-form-urlencoded' : 'application/json',
    }
    if (params) config.params = params
    return request(config)
  },
  delete(params,url,headers) {
    const config = {
      method: 'delete',
      url,
      header: headers ? 'application/x-www-form-urlencoded' : 'application/json',
    }
    if (params) config.params = params
    return request(config)
  }
}

export default https